﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.Serialization
{
    /// <summary>
    /// 序列化方式
    /// </summary>
    public enum SerializationType
    {
        None = 0,
        Binary = 1,
        Xml = 2,
        Json = 3,
    }

    public class SerializationTypeHelper
    {
        public static SerializationType Parse( string str )
        {
            SerializationType stype = SerializationType.None;
            try
            {
                stype = (SerializationType)Enum.Parse( typeof( SerializationType ), str, true );
            }
            catch
            {
                stype = SerializationType.Xml;
            }
            return stype;
        }
    }
}
